﻿<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>jQuery位置移动动画效果</title>
        <script src="js/jquery-3.6.1.min.js"></script>
        <style>
            div {
                width: 100px;
                height: 100px;
                background-color: green;
                color: white;
                position: relative;
            }
        </style>
    </head>
    <body>
        <h3>jQuery位置移动动画效果</h3>
        <hr>
        <button id="btn" type="button">
            开始移动
        </button>
        <br>
        <div>
            你好，jQuery动画！
        </div>
        <script>
            $(document).ready(function() {
                $("#btn").click(function() {
                    $("div").animate({
                        left : "+=200px",
                        top : "+=100px"
                    }, 2000);
                });
            });
        </script>
    </body>
</html>